import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * leetcode
 */
public class Solution2 {
    public static void main(String[] args) {
        // ip 排序
        String ip = "192.168.0.";
        List<String> ipList = new ArrayList<>();
        for (int i = 255; i >= 0; i--) {
            ipList.add(ip + i);
        }
        Collections.sort(ipList, (ip1, ip2) -> {
            String[] parts1 = ip1.split("\\.");
            String[] parts2 = ip2.split("\\.");
            for (int i = 0; i < parts1.length; i++) {
                int num1 = Integer.parseInt(parts1[i]);
                int num2 = Integer.parseInt(parts2[i]);
                if (num1 < num2) {
                    return -1;
                } else if (num1 > num2) {
                    return 1;
                }
            }
            return 0;
        });
        ipList.forEach(System.out::println);
    }

}
